﻿// 文件路径：AyuBookmark.Service/Services/InputEventService.cs
using AyuBookmark.Common.Input;
using AyuBookmark.Common.Interfaces;

namespace AyuBookmark.Service.Services
{
    /// <summary>
    /// 输入事件处理服务
    /// </summary>
    public class InputEventService : IKeyboardMouseEvents
    {
        private readonly IShortcutService _shortcutService;
        private InputListener _listener;

        public InputEventService(IShortcutService shortcutService)
        {
            _shortcutService = shortcutService;
            _listener = new InputListener(this);
        }

        public void OnKeyPressed(VirtualKeyCode key)
        {
            _shortcutService.ProcessKeyPress(key);
        }

        public void OnMouseClicked(MouseButton button)
        {
            // 鼠标点击处理逻辑
        }

        public void StartListening()
        {
            _listener ??= new InputListener(this);
        }

        public void StopListening()
        {
            _listener?.Dispose();
            _listener = null;
        }
    }
}